<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="root">
        <button @click="updataMei">更新马冬梅的信息</button>
        <ul>
            <li v-for='p in peoples' :key="p.id">{{p.name}}-{{p.age}}</li>
        </ul>
    </div>
    <script>
        Vue.config.productionTip = false;
        let vm = new Vue({
            el: '#root',
            data: {
                peoples:[
                    {id:01,name:'马冬梅',age:30},
                    {id:02,name:'周冬雨',age:19},
                    {id:03,name:'周杰伦',age:24},
                    {id:04,name:'温兆伦',age:21},
                ],
            },
            methods: {
                updataMei(){
                    // 奏效
                    // this.peoples[0].name = '马老师';
                    // this.peoples[0].age = 55;
                    // this.peoples[0].id = 05;

                    this.peoples[0] = {name:'马老师', age:55, id:05}
                }
            },
        });
    </script>
</body>
</html>